<%= render :partial => '/partial/header' %>
<script type="text/javascript">
  //关闭修改密码窗口
function closePwd() {
  $('#w').window('close');
}

//修改密码
function changePwd() {
  var $newpass = $('#txtNewPass');
  var $rePass = $('#txtRePass');

  if ($newpass.val() == '') {
    msgShow('系统提示', '请输入密码！', 'warning');
    return false;
  }
  if ($rePass.val() == '') {
    msgShow('系统提示', '请在一次输入密码！', 'warning');
    return false;
  }

  if ($newpass.val() != $rePass.val()) {
    msgShow('系统提示', '两次密码不一至！请重新输入', 'warning');
    return false;
  }

  $.post('/users/changepwd?newpass=' + $newpass.val(), function(msg) {
      msgShow('系统提示', '恭喜，密码修改成功！<br>您的新密码为：' + msg, 'info');
      $newpass.val('');
      $rePass.val('');
      closePwd();
      })
}

$(function() {
    $('#editpass').click(function() {
      $('#w').window('open');
      });

    $('#btnEp').click(function() {
      changePwd();
      })

    $('#btnCancel').click(function(){closePwd();})

    $('#logout').click(function() {
      $.messager.confirm('系统提示', '您确定要退出本次登录吗?', function(r) {
        if (r) {
        location.href = '/users/logout';
        }
        });
      })
    var centerwidth = $('#wrapper').width() - 250;
    $('#main-panel').panel('resize',{width:centerwidth});
    });
  </script>
</head>
<title>阿梦德斯培训中心管理系统</title>
<body>
  <div id="wrapper">
    <noscript>
      <div style=" position:absolute; z-index:100000; height:2046px;top:0px;left:0px; width:100%; background:white; text-align:center;">
        <img src="images/noscript.gif" alt='抱歉，请开启脚本支持！' />
      </div>
    </noscript>
    <div id="north-panel"> 
      <span style="float:right; padding-right:20px;" class="head">
        欢迎 <%= session[:user][:name] %> 
        <a href="#" id="editpass">修改密码</a> 
        <a href="#" id="logout">安全退出</a>
      </span>
      <span style="padding-left:10px; font-size: 16px; ">
        <img src="../images/blocks.gif" width="20" height="20" align="absmiddle" />Amadeus管理系统
      </span>
    </div>    
    <div id="west-panel">
      <%= render :partial => '/partial/menu' %>
    </div>
    <div id="center-panel"> 
      <div id='main-panel' class="easyui-panel" title="<%= @title %>" style="height: 800px;">
        <div id="content-panel">
        <%= yield %>
        </div>
      </div>
    </div>
    <div class="clear"></div>
    <div id="south-panel"> 
    </div>
    <!--修改密码窗口-->
    <%= render :partial => '/partial/password' %> 
  </div>
</body>
</html>
